<?php
session_start();
$_SESSION['caweb']['basededatos'] = "caweb_rc";
require_once "../funciones.php";
$caweb_rc = con_caweb();
$sql = "select * from temporal_fisico2 where id >= 1 and id <= 77";
$result = mysql_query($sql);
$con = 0;
while($fila = mysql_fetch_array($result)){
    $interno = $fila[interno];
    $estado = $fila[item];
    $sql = "select * from basefacturacion where interno = '$interno' and estado = '$estado' and cliente = '800065519'";
    $result1 = mysql_query($sql);
    $base = mysql_fetch_array($result1);
    if (is_array($base)){
        $con ++;
        $sql = "update basefacturacion set cliente = '830098352',
                                            fechainiciofacturacion = '2010-06-01',
                                            desde = '2010-06-01',
                                            hasta = '2010-06-30'
                                       where id = $base[id]";
        $result1 = mysql_query($sql);
        $error = mysql_error();
        $sql = "update seriales set ubicacion = '830098352' where interno = '$interno'";
        $result1 .= mysql_query($sql);
        $error = mysql_error();
        if($error == "" ){
            $sql = "delete from temporal_fisico2 where id = $fila[id]";
            $result1 .= mysql_query($sql);
        }
    }
}
echo "hay termino $con";
?>
